package dao;

import domain.AbstractDomain;
import domain.User;
import org.springframework.orm.hibernate3.HibernateTemplate;

/**
 * Created by zhifu on 2015/3/24.
 */
public class UserDaoImpl implements UserDao {
    private HibernateTemplate hibernateTemplate;

    @Override
    public void saveOrUpdate(AbstractDomain domain) {
        hibernateTemplate.saveOrUpdate(domain);
    }

    @Override
    public User findUserByGuid(String guid) {
       return (User) hibernateTemplate.find("from User where guid= ?",guid).get(0);
    }

    public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
        this.hibernateTemplate = hibernateTemplate;
    }
}
